#pragma once


class good_vector
{

private:
    
   static const size_t expand_ = 2;
   static const size_t collapse_ = 4;
   size_t size_;
   size_t capacity_;
   union
   {
      size_t digit;
      size_t* digits;
   } elements_;

   void expand();
   void collapse();
   void ensure_capacity(size_t new_size);
   void copy(size_t* dest, const size_t* source, size_t length);

public:
   good_vector();
   good_vector(size_t len, size_t fill_value);
   good_vector(const good_vector& val);
   ~good_vector();

   size_t size() const;
   void push_back(size_t val);
   size_t pop_back();
   void resize(size_t new_size);
   void reverse();
   void swap(good_vector& other);

   good_vector& operator =(const good_vector& val);
   size_t operator [](size_t index) const;
   size_t& operator [](size_t index);
   
};
